package rsj.sql.auth;

import com.rlyy.aibase.utils.base.TableNode;
import rsj.annotation.Param;
import rsj.annotation.Select;

/**
 * 查询角色的菜单
 *
 * @author yuanqinglong
 * @since 2021/5/28 11:22
 */
public interface RoleMenuDao {

    /**
     * 查询用户菜单
     *
     * @param userId 用户id
     * @return {@link TableNode}
     */
    @Select("SELECT menu_id,menu_pid,menu_title,menu_level,menu_url FROM (SELECT rome_menu_id FROM sys.sys_rome WHERE rome_role_id = " +
            "(SELECT User_Role_Id FROM sys.sys_user WHERE user_id = #{userId})) rm  LEFT JOIN sys.sys_menu m ON rm.rome_menu_id= m.menu_id")
    TableNode queryMenuByUserId(@Param("userId") String userId);
}
